<template>
    <div class="box" v-if="arr">
        <div class="box1">
            <ul>
                <li v-for="(item,index) in arr "
                :key="index"
                >
                    <img @click="goVideo(item.video.url)" :src="item.video.imgUrl"  v-lazy="img" alt="" >
                    <p class="timu">{{item.title}}</p>
                    <div class="bofang"  @click="goVideo(item.video.url)">
                        <van-icon name="play-circle-o"  size="50" color="#999" />
                    </div>
                    <div class="use">
                        <div class="box2">
                            <div class="img-box">
                                <img :src="item.user.avatarurl" alt="">
                                <span>{{item.user.nickName}}</span>
                            </div>
                            <div class="good"  @click.once="item.video.dur++">
                                 <img src="../assets/images/good.png" alt="">
                                <span>{{item.video.dur}}</span>
                            </div>
                        </div>
                    </div>
                </li>
            </ul>
        </div>
    </div>
</template>
<script>
import myToubu from'../components/myhead.vue';
export default {
    components:{
        myToubu
    },
    data(){
        return{
            arr:null
        }
    },
    methods:{
          goVideo(a){
            // console.log(a);
            // this.$router.push('/myVideo')
            this.$router.push({path:'/myVideo',query:{video:a}})
            console.log(1);

        },
        async mYrequest(){
            let re =await this.axios.get("https://apis.netstart.cn/maoyan/video/0").catch(err=>{
                console.log(err);
            })
            // console.log(re.data.data.feeds);
            this.arr = re.data.data.feeds
            console.log(this.arr);
        }   

    },
    created(){
        this.mYrequest()
    }
}
</script>
<style lang="less" scoped>
    .box{
        box-sizing: border-box;
        width: 100%;
        padding-bottom: 50px;
        .box1{
            ul{
                li{
                    position: relative;
                    &:nth-child(1){
                        margin-top: 0;
                    }
                    box-sizing: border-box;
                    margin: 50px 0;
                    width: 100%;
                    height: 234px;
                    img{
                        width: 100%;
                        height: 100%;
                    }
                    .timu{
                        background-color: rgba(0,9,0,0.3);
                        font-size: 20px;
                        width: 100%;
                        box-sizing: border-box;
                        padding: 5px;
                        color: white;
                        position: absolute;
                        top: 0;
                        left: 0;
                    }
                    .bofang{
                      
                        position: absolute;
                        top: 40%;
                        left:45%;
                       
                    }
                    .use{
                        padding: 0 10px;
                        .box2{
                            display: flex;
                            justify-content: space-between;
                            .img-box{
                              
                                img{
                                    width: 22px;
                                    height: 22px;
                                    vertical-align: middle;
                                    border-radius: 50px;
                                    overflow: hidden;
                                }
                                span{
                                    margin-left: 5px;
                                    font-size: 15px;
                                    display: inline-block;
                                }
                            }
                            .good{
                                img{
                                    width: 18px;
                                    height: 18px;
                                    vertical-align: middle;
                                    margin-right: 10px;
                                }
                                span{
                                    font-size: 15px;
                                    color: #696969;
                                }
                            }
                        }

                    }
                }
            }
        }
    }
</style>